<?php
declare (strict_types=1);

namespace app\common\model;

class ProductCate extends Base
{
    public static function getAll()
    {
        try {
            $result = parent::where(['is_del' => 0])->order('sort desc, id asc')->select()->toArray();

        } catch (\Exception $e) {

            return [];
        }

        return mergeMenu($result);
    }

    public static function getCate($id = 0)
    {
        return parent::where(['pid' => $id, 'status' => 1, 'is_del' => 0])->field('id,title,icon')
            ->order('sort desc, id asc')->select();
    }
}